#ifndef __USART_H__
#define __USART_H__
#include <main.h>
#include "queue.h"


#define USART_CACHE_LEN			256
typedef struct {
    uint8_t data[USART_CACHE_LEN];
    __IO uint16_t cnt;
} usart_cache;
extern usart_cache usart1_cache;

typedef struct {
    __IO uint32_t cnt;
} usart_cnt;
extern usart_cnt usart1_cnt;


void RingBuffIni(RingBuff *pbuff);
uint8_t Read_RingBuff(RingBuff *pbuff, DataBuff *rdata);
uint8_t Write_RingBuff(RingBuff *pbuff, uint8_t *wdata, uint16_t len);
uint8_t RingBuffRst(RingBuff *pbuff);

void usart_init(void);
void usart1_init(void);
HAL_StatusTypeDef HAL_UART_Transmit(USART_Module* USARTx, uint8_t* data, uint32_t len, uint32_t time_out);
HAL_StatusTypeDef HAL_UART_Receive(USART_Module* USARTx, uint8_t* data, uint32_t len, uint32_t time_out);
#endif

